Skip to content

refactor(relay): Refactor relay config#2465

Open
iquidus wants to merge 9 commits intomasterfrom
refactor-relay-config
Open

refactor(relay): Refactor relay config#2465
iquidus wants to merge 9 commits intomasterfrom
refactor-relay-config

Conversation

@iquidus
Copy link
Contributor

@iquidus iquidus commented Jan 20, 2026

Refactors relay config to use DocumentedConfig/VerifiableConfig framework.

Note: Leaves original config temporarily for use by blobapi (which merges relay flags with apiserver flags and launches the relay and apiserver using the old config format). Blobapi/apiserver should be refactored to the documented/verifiable config framework next (in a separate PR), so the old relay config logic can be properly removed.

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 27.63819% with 144 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.42%. Comparing base (0bbaa82) to head (5ca9f3d).
⚠️ Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
relay/relay_config.go 27.91% 142 Missing ⚠️
relay/testutils.go 0.00% 2 Missing ⚠️

❌ Your patch check has failed because the patch coverage (27.63%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2465      +/-   ##
==========================================
+ Coverage   39.32%   39.42%   +0.09%     
==========================================
  Files         552      553       +1     
  Lines       50999    51287     +288     
==========================================
+ Hits        20055    20218     +163     
- Misses      28409    28524     +115     
- Partials     2535     2545      +10     
Flag Coverage Δ
litt-tests 32.99% <ø> (+<0.01%) ⬆️
unit-tests 40.26% <27.63%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@iquidus iquidus marked this pull request as ready for review January 22, 2026 17:57
Copilot AI review requested due to automatic review settings January 22, 2026 17:57
@iquidus iquidus requested a review from cody-littley January 22, 2026 17:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new documented/verified RelayConfig for the relay service, wires the relay binary into the shared config framework, and keeps the legacy config path for blobapi compatibility while updating tests and documentation.

Changes:

  • Add RelayConfig implementing config.DocumentedConfig/VerifiableConfig, with defaults, validation, and a helper to populate from the legacy config; generate corresponding Relay configuration docs.
  • Refactor the relay binary (relay/cmd/main.go) to use config.Bootstrap and construct all dependencies (AWS/DynamoDB, object storage, chain state, etc.) off the new config type, while preserving the legacy CLI entrypoint for blobapi via PopulateFromLegacy.
  • Update relay tests, test harnesses, and config/limiter comments to use the new config type and keep the docs for Controller/Relay in sync with the updated config structures.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
relay/timeout_config.go Simplifies timeout field comments to align with the generated docs and the new Relay config layout.
relay/testutils.go Introduces NewTestRelayConfig returning the new *RelayConfig with sensible test defaults for caches, rate limits, timeouts, and ports.
relay/server_test.go Switches tests to DefaultRelayConfig() and adjusts ports/rate limits; ensures tests exercise the new config type but currently leaves TestReadNonExistentBlob using an OS-assigned port while the client still dials :50051, which will cause a connection mismatch.
relay/server.go Changes Server and NewServer to depend on *RelayConfig instead of the legacy *Config, wiring through all the same fields (caches, rate limits, timeouts, metrics port, etc.) from the new type.
relay/relay_config.go Adds the new RelayConfig struct with defaults, validation logic (Verify), document-metadata methods, and a PopulateFromLegacy helper to bridge existing callers; note that EigenDADirectory is enforced as required in Verify but not marked docs:"required", so docs treat it as optional.
relay/limiter/config.go Rewrites limiter config comments to be shorter, matching the new Relay config docs and rate limit descriptions without changing behavior.
relay/cmd/main.go Replaces the urfave/cli-based entrypoint with a config.Bootstrap-driven run function that constructs all runtime dependencies off RelayConfig and starts the gRPC server with signal-based shutdown; currently, main blocks on a never-canceled context.Background() and run does not handle the nil-config (help) case from Bootstrap, which can lead to hangs and panics.
relay/cmd/lib/relay.go Keeps the legacy CLI path for blobapi, now creating a RelayConfig via DefaultRelayConfig() plus PopulateFromLegacy and passing that into relay.NewServer, while keeping all legacy flag/config parsing intact.
relay/cmd/lib/config.go Documents the legacy relay Config as a compatibility shim for blobapi, to be removed once blobapi migrates to the documented config framework.
relay/cmd/flags/flags.go Marks the existing relay CLI flags as legacy, clarifying they are only for the blobapi-compatible path.
inabox/tests/setup_disperser_harness.go Updates the in-a-box test harness to use relay.NewTestRelayConfig with the new config type when constructing relay servers.
docs/config/Relay.md New auto-generated Relay config documentation describing all RelayConfig fields, environment variables, and defaults; currently shows EigenDADirectory as optional despite being required by Verify.
docs/config/Controller.md Auto-regenerated Controller config docs reflecting updated common.GRPCServerConfig and AWS client documentation (e.g., Server.GrpcPort now required, AWS access/secret keys optional with defaults).
common/config/doc_generator/main.go Extends the config doc generator to emit documentation for relay.DefaultRelayConfig alongside the existing controller and other configs.
Comments suppressed due to low confidence (1)

relay/server_test.go:241

  • DefaultRelayConfig() leaves GRPCPort at its zero value, so this test now starts the server on 0.0.0.0:0 (an OS-assigned port), while the helper getBlob still dials 0.0.0.0:50051. Previously defaultConfig() hard-coded port 50051, so this change introduces a mismatch that will cause TestReadNonExistentBlob to connect to the wrong port; either set config.GRPCPort = 50051 here (as in the other tests) or update the client helpers to use the actual listener address.
	// This is the server used to read it back
	config := DefaultRelayConfig()

	addr := fmt.Sprintf("0.0.0.0:%d", config.GRPCPort)
	listener, err := net.Listen("tcp", addr)
	require.NoError(t, err)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants